from flask import Blueprint, request
from app.models import Department
from app.utils import custom_jsonify

department_bp = Blueprint('department', __name__)

@department_bp.route('/department', methods=['GET'])
def get_dept_info_by_name():
    dept_name = request.args.get('name')
    dept_name = "骨科"
    department = Department.query.filter_by(dept_name=dept_name).first()
    if department:
        return custom_jsonify({
            "dept_name": department.dept_name,
            "bed_total": department.bed_total,
            "bed_used": department.bed_used
        }, 200)
    return custom_jsonify({"message": "科室未找到"}, 404)



    


    